<html lang="en">
    <head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
     	<body style="background-color:#FFF;padding-bottom:40px;">
	<?php
	require_once(dirname(__FILE__)."/lib/mysql.php");
	
	$_PARA 	= array() ;
	if(array_key_exists('item_id',$_POST))	$_PARA 		= $_POST ;
	else									$_PARA 		= $_GET ;

	$item_id     = intval($_PARA['item_id']);
	if ($item_id == 0){
		echo "error no item_id ." ;
		exit(0) ;
	}
	
	sql_connect();
	$item = sql_fetch_one("select * from sys_item where `id` = $item_id") ;
	if (is_array($item) == false || array_key_exists("id", $item) == false){
		echo "error item_id not find." ;
		exit(0) ;
	}
	echo "<style type='text/css'>
			.detail{
				padding:60px;
				background-color:#FFF;
				height:100%;
			}
			.detail span{
				font-size:40px;
				font-family:'AppleGothic';
				font-color:#BBB;
			}
		  </style>
			";
	echo "<div class='detail'>";
	echo "<span>品名 : " . $item['name']."</span>";
	
	if (intval($item['brand_id']) > 0){
		echo "<br><span>品牌 : " . sql_fetch_one_cell("select `name` from grp_brand where `id` = '{$item['brand_id']}'")."</span>";
	}
	
	if (strlen($item['gjj_code']) > 0){
		echo "<br><span>编码 : " . $item['gjj_code']."</span>";
	}
	
	$sery = sql_fetch_rows("select g.`name` from sys_item_sery s left join grp_sery g on s.sery_id = g.`id` where s.`item_id` = '{$item['id']}'") ;
	if (count($sery) > 0){
		echo "<br><span>系列 : " ;
		$dh = "" ;
		foreach ($sery as $s){
			echo $dh.$s['name'] ;
			$dh = "," ;
		} 
	}
	echo "</span>";
	
	$style = sql_fetch_rows("select g.`name` from sys_item_style s left join grp_style g on s.style_id = g.`id` where s.`item_id` = '{$item['id']}'") ;
	if (count($style) > 0){
		echo "<br><span>风格 : " ;
		$dh = "" ;
		foreach ($style as $s){
			echo $dh.$s['name'] ;
			$dh = "," ;
		} 
	}
	echo "</span>";
	
	$color = sql_fetch_rows("select g.`name` from sys_item_color s left join grp_color g on s.color_id = g.`id` where s.`item_id` = '{$item['id']}'") ;
	if (count($color) > 0){
		echo "<br><span>色系 : " ;
		$dh = "" ;
		foreach ($color as $s){
			echo $dh.$s['name'] ;
			$dh = "," ;
		} 
	}
	echo "</span>";
	
	if (strlen($item['size']) > 0){
		echo "<br><span>规格 : " . $item['size'] ;
	}
	//面料
	$str="";
if($item['fabric_list']!="")
{
	$t=str_replace(","," or id = ",$item['fabric_list']);
	$fabric=sql_fetch_rows("select * from base_sys_fabric where id = ".$t);
	if(count($fabric)>0)
	{
		foreach($fabric as $f)
		{
			if($str=="")
			{
				$str.=$f['name'];
			}
			else
			{
				$str.=",".$f['name'];
			}
		}
	}
	if($str!="")
	{
		echo "<br><span>面料 : ".$str."</span>";
	}
}
	
	//材质
	$str="";
	if($item['material_list']!="")
	{
		$t=str_replace(","," or id = ",$item['material_list']);
		$material=sql_fetch_rows("select * from base_sys_material where id = ".$t);
		if(count($material)>0)
		{
			foreach($material as $m)
			{
				if($str=="")
				{
					$str.=$m['name'];
				}
				else
				{
					$str.=",".$m['name'];
				}
			}
		}
		if($str!="")
		{
			echo "<br><span>材质 : ".$str."</span>";
		}
	}

	$str="";
	$place = sql_fetch_rows("select g.`name` from sys_item_place s left join grp_place g on s.place_id = g.`id` where s.`item_id` = '{$item['id']}'") ;
	if (count($place) > 0){
		echo "<br><span>产地 : " ;
		$dh = "" ;
		foreach ($place as $s){
			echo $dh.$s['name'] ;
			$dh = "," ;
		} 
	}
	echo "</span>";
	
	if (strlen($item['volume']) > 0){
		echo "<br><span>体积 : " . $item['volume']."</span>";
	}
	if (strlen($item['package']) > 0){
		echo "<br><span>包装件数 : " . $item['package']."</span>";
	}
	if (strlen($item['tips']) > 0){
		echo "<br><span>描述 : " . $item['tips']."</span>";
	}
	echo "</div>"
?>
	</body>
</html>
